home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / icoxtr / form1.frm < prev    next >
Text File  |  1995-05-08  |  2KB  |  89 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Extract Icon"
  4.    ClientHeight    =   1095
  5.    ClientLeft      =   4815
  6.    ClientTop       =   3630
  7.    ClientWidth     =   2670
  8.    Height          =   1500
  9.    Left            =   4755
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   73
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   178
  15.    Top             =   3285
  16.    Width           =   2790
  17.    Begin CommandButton Command2 
  18.       Caption         =   "Exit"
  19.       Height          =   372
  20.       Left            =   1680
  21.       TabIndex        =   2
  22.       Top             =   600
  23.       Width           =   852
  24.    End
  25.    Begin PictureBox IconPic 
  26.       Height          =   408
  27.       Left            =   360
  28.       ScaleHeight     =   25
  29.       ScaleMode       =   3  'Pixel
  30.       ScaleWidth      =   25
  31.       TabIndex        =   1
  32.       Top             =   528
  33.       Width           =   408
  34.    End
  35.    Begin CommandButton Command1 
  36.       Caption         =   "Do It!"
  37.       Height          =   372
  38.       Left            =   1680
  39.       TabIndex        =   0
  40.       Top             =   120
  41.       Width           =   852
  42.    End
  43.    Begin VScrollBar VScroll1 
  44.       Height          =   852
  45.       Left            =   1200
  46.       Max             =   4
  47.       TabIndex        =   4
  48.       Top             =   120
  49.       Width           =   252
  50.    End
  51.    Begin Label Label1 
  52.       Alignment       =   2  'Center
  53.       Caption         =   "Icon"
  54.       Height          =   252
  55.       Left            =   192
  56.       TabIndex        =   3
  57.       Top             =   192
  58.       Width           =   732
  59.    End
  60. End
  61. Dim iIcon As Integer
  62.  
  63. Sub Command1_Click ()
  64. ' clear the pic
  65. IconPic.Cls
  66. ' get the instance of the caller
  67. hCurrentInst% = GetWindowWord(Form1.hWnd, GWW_HINSTANCE)
  68. ' extract a progman icon
  69. hIcon% = ExtractIcon(hCurrentInst%, "progman.exe", iIcon)
  70. ' must insure this before calling DrawIcon
  71. homap% = SetMapMode(IconPic.hDC, MM_TEXT)
  72. ' now draw it
  73. drw% = DrawIcon(IconPic.hDC, 0, 0, hIcon%)
  74. End Sub
  75.  
  76. Sub Command2_Click ()
  77. Unload Form1
  78. End Sub
  79.  
  80. Sub Form_Load ()
  81. Label1.Caption = Label1.Caption + " #" + Str$(VScroll1.Value)
  82. End Sub
  83.  
  84. Sub VScroll1_Change ()
  85. iIcon = VScroll1.Value
  86. Label1.Caption = "Icon #" + Str$(VScroll1.Value)
  87. End Sub
  88.  
  89.